   

/************************************************************************/
/* 
*/
/************************************************************************/

#pragma once

#include "mainwindow.h"

#include <vector>
#include "picking.h"

struct Label
{
	int x, y, fontSize;
	std::string text;
	bool bHighlight;
	double fontLength;

	Label( std::string _s,  int _x, int _y, int _sz, bool _hl ) 
		:text(_s), x(_x), y(_y), fontSize(_sz), bHighlight(_hl)
	{ fontLength = 0.0; }
};


class EGLWidget
{
public:
	EGLWidget( EGLNativeDisplayType nativeDpy, EGLNativeWindowType nativeWindow );
	virtual ~EGLWidget();

public:
	virtual void paintEvent( ) = 0;
	virtual void keyEvent( int key, int modifier ) = 0;
};

class GuiDemo : public MainWindow
{
	std::vector<Label> lbs;
	int selectedLabel;

	EGLContext		eglctx;
	EGLSurface		egl_surface;

	PickingDemo m_widget0;
	bool focus=true;

public:
	GuiDemo(EGLNativeDisplayType nativeDpy, EGLNativeWindowType nativeWindow);
	~GuiDemo(void);

public:	
	virtual void onCreate();
	virtual void paintEvent( );
	virtual void keyEvent( int key, int state );

private:
	double drawHighlight( cairo_t* hdc, std::string& s, int x, int y, int fontSize, bool bHighlight =false );
	void drawLabel( cairo_t* hdc, Label& lb );
	void drawGui( int width, int height );
	void loadString(const char* Id, std::string & rc );
};
